#include "StatusBar.h"

CStatusBar::CStatusBar()
{
   memset (m_uMenuHelps, 0, sizeof (m_uMenuHelps));
}

CStatusBar::~CStatusBar()
{
}

HWND CStatusBar::Create(HWND hParent, WORD wID, DWORD style)
{
   HWND hWnd = CreateWindowEx(
                              0,                                  // no extended styles
                              STATUSCLASSNAME,                    // name of status bar class
                              (LPCTSTR) NULL,                     // no text when first created
                              style | WS_VISIBLE |WS_CHILD,       // a visible child
                              0, 0, 0, 0,                         // ignores size and position
                              hParent,                            // handle to parent window
                              (HMENU) wID,                        // status bar identifier
                              _Module.GetModuleInstance(),        // handle to application instance
                              NULL);                              // no window creation data

   if (!hWnd) {
      return NULL;
   }

   Attach(hWnd);
   BOOL bUnicode = FALSE;
#ifdef UNICODE
   bUnicode = TRUE;
#endif
 
   SendMessage(m_hWnd, SB_SETUNICODEFORMAT, (WPARAM)bUnicode, 0);
   return m_hWnd;    
}

void CStatusBar::SetMenuPrompt(HMENU hMenu)
{
   m_uMenuHelps[1] = (UINT)hMenu;
}

void CStatusBar::MenuHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, HMENU hMenu)
{
   assert (::IsWindow(m_hWnd));

   ::MenuHelp(uMsg, wParam, lParam, hMenu, _Module.GetModuleInstance(), m_hWnd, m_uMenuHelps);
}

